import * as actionType from '../action/actionType'
const initState = {
  counter: 10
}
//reducer 必须是一个方法 有两个参数 第一个是state 第二个参数是action
export default (state = initState, action) => {
  switch (action.type) {
    case actionType.ADD:
      return {
        ...state,
        counter: state.counter + 1
      }
    case actionType.JIAN:
      return {
        ...state,
        counter: state.counter - 1
      }
    default:
      return state
  }
}
